//
//  ZDBExchangeOrderCell.m
//  ZDB
//
//  Created by Kk on 2020/3/23.
//  Copyright © 2020 ZDB. All rights reserved.
//

#import "ZDBExchangeOrderCell.h"

@implementation ZDBExchangeOrderCell

- (void)awakeFromNib {
    [super awakeFromNib];
    KViewBorder(_duplicateButton, ColorStr(@"#666666"), 0.5);
    KViewRadius(_duplicateButton, _duplicateButton.height/2);
    KViewRadius(self.merchandise_icon, 2);
    self.selectionStyle = UITableViewCellAccessoryNone;
    self.order_NO.hidden = YES;
    self.duplicateButton.hidden = YES;
    self.lineView.hidden = YES;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

-(void)setModell:(ZDBExchangeModel *)modell{
    
    _modell = modell;
   // [NSURL URLWithString:modell.goodsUrl]
    //kURLforString(modell.goodsUrl)
    //兑换商品状态 1=等待发货 2=发货成功 3=收货成功
    [self.merchandise_icon sd_setImageWithURL:[NSURL URLWithString:modell.goodsUrl] placeholderImage:CoverPlaceHolderImage];
    self.merchandise_name.text = modell.name;
    
  //  self.number.text = [NSString stringWithFormat:@"已兑换%@件",kStringForNumber(modell.exchangeNumber)];
    self.integralLab.text = [NSString stringWithFormat:@"%@积分",kStringForNumber(modell.integral)];

    self.exchange_No.text = [NSString stringWithFormat:@"兑换时间:%@",modell.createTime];
    
    NSString * str1  = [NSString stringWithFormat:@"快递单号:%@",modell.orderNumber];
     NSString * str2 = [NSString stringWithFormat:@"快递物流:%@",modell.logisticsCompany];
    self.order_NO.text = [NSString stringWithFormat:@"%@\n%@",str2,str1];
    if ([modell.state integerValue]==1) {
        self.statusLab.text = @"等待发货";
           self.order_NO.hidden = YES;
        self.duplicateButton.hidden = YES;
        self.lineView.hidden = YES;
    }else if ([modell.state integerValue]==2){
        self.statusLab.text = @"发货成功";
        self.order_NO.hidden = NO;
        self.duplicateButton.hidden = NO;
        self.lineView.hidden = NO;
    }else{
       self.statusLab.text = @"收货成功";
        self.order_NO.hidden = YES;
        self.duplicateButton.hidden = YES;
        self.lineView.hidden = YES;
    }
}



@end
